package com.wanxin.wb.module.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wanxin.wb.common.dao.oracle.master.IUserReadWriteDao;
import com.wanxin.wb.common.model.UserVO;
import com.wanxin.wb.common.support.BaseController;
import com.wanxin.wb.common.support.json.JsonParam;





@Controller
@RequestMapping("/weixin/cn/page")
public class PageDemoController extends BaseController {
	
	@Autowired
	private IUserReadWriteDao   urserWriteDao;
	
	
	  @RequestMapping(value = "/test", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
	   @ResponseBody
	   public String test(@RequestParam(value = "data", required = true) String data) {
		 
		  JsonParam jsonParam = JsonParam.newInstance(data);
		  //查询第几页
		  int   pageIndex=Integer.parseInt(jsonParam.getParameter_String("index"));
		  //每页1条
		  Page page = PageHelper.startPage(pageIndex, 1);
		  
		  List<UserVO> list=	  urserWriteDao.findByAccountList();
		  
		 long total= page.getTotal();
		 
		 System.out.println(">>>>>>>>>>>>>总共 "+total+"页");
		   return success(list); 
				  
				  
	  }
	
	

}
